﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract OsnovnoSredstvo typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class OsnovnoSredstvoDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<OsnovnoSredstvoDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.OsnovnoSredstvo _currentOsnovnoSredstvo = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxOsnovnoSredstvoDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxOsnovnoSredstvoErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxOsnovnoSredstvoBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDParentOS property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDParentOSDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDDobavljac property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDDobavljacDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Sifra property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSifraDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kolicina property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKolicinaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumKnjizenja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumKnjizenjaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Opis property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOpisDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Napomena property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNapomenaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TvBroj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTvBrojDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Detalji property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDetaljiDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Klijent> _IDDobavljacList;
		
		/// <summary> 
		/// The list of selectable Klijent
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Klijent> IDDobavljacList
		{
			get {return this._IDDobavljacList;}
			set 
			{
				this._IDDobavljacList = value;
				this.uxIDDobavljacDataGridViewColumn.DataSource = null;
				this.uxIDDobavljacDataGridViewColumn.DataSource = this._IDDobavljacList;
			}
		}
		
		private bool _allowNewItemInIDDobavljacList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Klijent
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDDobavljacList
		{
			get { return _allowNewItemInIDDobavljacList;}
			set
			{
				this._allowNewItemInIDDobavljacList = value;
				this.uxIDDobavljacDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.OsnovnoSredstvo> _IDParentOSList;
		
		/// <summary> 
		/// The list of selectable OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.OsnovnoSredstvo> IDParentOSList
		{
			get {return this._IDParentOSList;}
			set 
			{
				this._IDParentOSList = value;
				this.uxIDParentOSDataGridViewColumn.DataSource = null;
				this.uxIDParentOSDataGridViewColumn.DataSource = this._IDParentOSList;
			}
		}
		
		private bool _allowNewItemInIDParentOSList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of OsnovnoSredstvo
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDParentOSList
		{
			get { return _allowNewItemInIDParentOSList;}
			set
			{
				this._allowNewItemInIDParentOSList = value;
				this.uxIDParentOSDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.OsnovnoSredstvo> _OsnovnoSredstvoList;
				
		/// <summary> 
		/// The list of OsnovnoSredstvo to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.OsnovnoSredstvo> OsnovnoSredstvoList
		{
			get {return this._OsnovnoSredstvoList;}
			set
			{
				this._OsnovnoSredstvoList = value;
				this.uxOsnovnoSredstvoBindingSource.DataSource = null;
				this.uxOsnovnoSredstvoBindingSource.DataSource = value;
				this.uxOsnovnoSredstvoDataGridView.DataSource = null;
				this.uxOsnovnoSredstvoDataGridView.DataSource = this.uxOsnovnoSredstvoBindingSource;				
				//this.uxOsnovnoSredstvoBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxOsnovnoSredstvoBindingSource_ListChanged);
				this.uxOsnovnoSredstvoBindingSource.CurrentItemChanged += new System.EventHandler(OnOsnovnoSredstvoBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnOsnovnoSredstvoBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentOsnovnoSredstvo = uxOsnovnoSredstvoBindingSource.Current as Entities.OsnovnoSredstvo;
			
			if (_currentOsnovnoSredstvo != null)
			{
				_currentOsnovnoSredstvo.Validate();
			}
			//_OsnovnoSredstvo.Validate();
			OnCurrentEntityChanged();
		}

		//void uxOsnovnoSredstvoBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.OsnovnoSredstvo"/> instance.
		/// </summary>
		public Entities.OsnovnoSredstvo SelectedOsnovnoSredstvo
		{
			get {return this._currentOsnovnoSredstvo;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxOsnovnoSredstvoDataGridView.VirtualMode;}
			set
			{
				this.uxOsnovnoSredstvoDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxOsnovnoSredstvoDataGridView.AllowUserToAddRows;}
			set {this.uxOsnovnoSredstvoDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxOsnovnoSredstvoDataGridView.AllowUserToDeleteRows;}
			set {this.uxOsnovnoSredstvoDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxOsnovnoSredstvoDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxOsnovnoSredstvoDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="OsnovnoSredstvoDataGridViewBase"/> class.
		/// </summary>
		public OsnovnoSredstvoDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxOsnovnoSredstvoDataGridView = new System.Windows.Forms.DataGridView();
			this.uxOsnovnoSredstvoBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxOsnovnoSredstvoErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDParentOSDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDDobavljacDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSifraDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKolicinaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDatumKnjizenjaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOpisDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNapomenaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTvBrojDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDetaljiDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDDobavljacBindingSource = new KlijentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDobavljacBindingSource)).BeginInit();
			//this.uxIDParentOSBindingSource = new OsnovnoSredstvoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDParentOSBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxOsnovnoSredstvoErrorProvider
			// 
			this.uxOsnovnoSredstvoErrorProvider.ContainerControl = this;
			this.uxOsnovnoSredstvoErrorProvider.DataSource = this.uxOsnovnoSredstvoBindingSource;						
			// 
			// uxOsnovnoSredstvoDataGridView
			// 
			this.uxOsnovnoSredstvoDataGridView.AutoGenerateColumns = false;
			this.uxOsnovnoSredstvoDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxOsnovnoSredstvoDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxIDParentOSDataGridViewColumn,
		this.uxIDDobavljacDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxSifraDataGridViewColumn,
		this.uxKolicinaDataGridViewColumn,
		this.uxDatumKnjizenjaDataGridViewColumn,
		this.uxOpisDataGridViewColumn,
		this.uxNapomenaDataGridViewColumn,
		this.uxTvBrojDataGridViewColumn,
		this.uxDetaljiDataGridViewColumn			});
			this.uxOsnovnoSredstvoDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxOsnovnoSredstvoDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxOsnovnoSredstvoDataGridView.Name = "uxOsnovnoSredstvoDataGridView";
			this.uxOsnovnoSredstvoDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxOsnovnoSredstvoDataGridView.TabIndex = 0;	
			this.uxOsnovnoSredstvoDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxOsnovnoSredstvoDataGridView.EnableHeadersVisualStyles = false;
			this.uxOsnovnoSredstvoDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnOsnovnoSredstvoDataGridViewDataError);
			this.uxOsnovnoSredstvoDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsnovnoSredstvoDataGridViewCellValueNeeded);
			this.uxOsnovnoSredstvoDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnOsnovnoSredstvoDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDParentOSDataGridViewColumn
			//
			this.uxIDParentOSDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDParentOSDataGridViewColumn.DataPropertyName = "IDParentOS";
			this.uxIDParentOSDataGridViewColumn.HeaderText = "IDParentOS";
			this.uxIDParentOSDataGridViewColumn.Name = "uxIDParentOSDataGridViewColumn";
			this.uxIDParentOSDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDParentOSDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDParentOSDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDDobavljacDataGridViewColumn
			//
			this.uxIDDobavljacDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDobavljacDataGridViewColumn.DataPropertyName = "IDDobavljac";
			this.uxIDDobavljacDataGridViewColumn.HeaderText = "IDDobavljac";
			this.uxIDDobavljacDataGridViewColumn.Name = "uxIDDobavljacDataGridViewColumn";
			this.uxIDDobavljacDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDobavljacDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDobavljacDataGridViewColumn.ReadOnly = false;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxSifraDataGridViewColumn
			//
			this.uxSifraDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSifraDataGridViewColumn.DataPropertyName = "Sifra";
			this.uxSifraDataGridViewColumn.HeaderText = "Sifra";
			this.uxSifraDataGridViewColumn.Name = "uxSifraDataGridViewColumn";
			this.uxSifraDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSifraDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSifraDataGridViewColumn.ReadOnly = false;		
			//
			// uxKolicinaDataGridViewColumn
			//
			this.uxKolicinaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKolicinaDataGridViewColumn.DataPropertyName = "Kolicina";
			this.uxKolicinaDataGridViewColumn.HeaderText = "Kolicina";
			this.uxKolicinaDataGridViewColumn.Name = "uxKolicinaDataGridViewColumn";
			this.uxKolicinaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKolicinaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKolicinaDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumKnjizenjaDataGridViewColumn
			//
			this.uxDatumKnjizenjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumKnjizenjaDataGridViewColumn.DataPropertyName = "DatumKnjizenja";
			this.uxDatumKnjizenjaDataGridViewColumn.HeaderText = "DatumKnjizenja";
			this.uxDatumKnjizenjaDataGridViewColumn.Name = "uxDatumKnjizenjaDataGridViewColumn";
			this.uxDatumKnjizenjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumKnjizenjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumKnjizenjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxOpisDataGridViewColumn
			//
			this.uxOpisDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOpisDataGridViewColumn.DataPropertyName = "Opis";
			this.uxOpisDataGridViewColumn.HeaderText = "Opis";
			this.uxOpisDataGridViewColumn.Name = "uxOpisDataGridViewColumn";
			this.uxOpisDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOpisDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOpisDataGridViewColumn.ReadOnly = false;		
			//
			// uxNapomenaDataGridViewColumn
			//
			this.uxNapomenaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNapomenaDataGridViewColumn.DataPropertyName = "Napomena";
			this.uxNapomenaDataGridViewColumn.HeaderText = "Napomena";
			this.uxNapomenaDataGridViewColumn.Name = "uxNapomenaDataGridViewColumn";
			this.uxNapomenaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNapomenaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNapomenaDataGridViewColumn.ReadOnly = false;		
			//
			// uxTvBrojDataGridViewColumn
			//
			this.uxTvBrojDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTvBrojDataGridViewColumn.DataPropertyName = "TvBroj";
			this.uxTvBrojDataGridViewColumn.HeaderText = "TvBroj";
			this.uxTvBrojDataGridViewColumn.Name = "uxTvBrojDataGridViewColumn";
			this.uxTvBrojDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTvBrojDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTvBrojDataGridViewColumn.ReadOnly = false;		
			//
			// uxDetaljiDataGridViewColumn
			//
			this.uxDetaljiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDetaljiDataGridViewColumn.DataPropertyName = "Detalji";
			this.uxDetaljiDataGridViewColumn.HeaderText = "Detalji";
			this.uxDetaljiDataGridViewColumn.Name = "uxDetaljiDataGridViewColumn";
			this.uxDetaljiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDetaljiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDetaljiDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDDobavljacDataGridViewColumn
			//				
			this.uxIDDobavljacDataGridViewColumn.DisplayMember = "ImeKlijenta";	
			this.uxIDDobavljacDataGridViewColumn.ValueMember = "ID";	
			this.uxIDDobavljacDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDDobavljacDataGridViewColumn.DataSource = uxIDDobavljacBindingSource;				
				
			//
			// uxIDParentOSDataGridViewColumn
			//				
			this.uxIDParentOSDataGridViewColumn.DisplayMember = "IDParentOS";	
			this.uxIDParentOSDataGridViewColumn.ValueMember = "ID";	
			this.uxIDParentOSDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDParentOSDataGridViewColumn.DataSource = uxIDParentOSBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxOsnovnoSredstvoDataGridView);
			this.Name = "OsnovnoSredstvoDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDobavljacBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDParentOSBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxOsnovnoSredstvoBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				OsnovnoSredstvoDataGridViewEventArgs args = new OsnovnoSredstvoDataGridViewEventArgs();
				args.OsnovnoSredstvo = _currentOsnovnoSredstvo;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class OsnovnoSredstvoDataGridViewEventArgs : System.EventArgs
		{
			private Entities.OsnovnoSredstvo	_OsnovnoSredstvo;
	
			/// <summary>
			/// the  Entities.OsnovnoSredstvo instance.
			/// </summary>
			public Entities.OsnovnoSredstvo OsnovnoSredstvo
			{
				get { return _OsnovnoSredstvo; }
				set { _OsnovnoSredstvo = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxOsnovnoSredstvoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnOsnovnoSredstvoDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxOsnovnoSredstvoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsnovnoSredstvoDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsnovnoSredstvoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].ID;
						break;
					case "uxIDParentOSDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].IDParentOS;
						break;
					case "uxIDDobavljacDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].IDDobavljac;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Naziv;
						break;
					case "uxSifraDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Sifra;
						break;
					case "uxKolicinaDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Kolicina;
						break;
					case "uxDatumKnjizenjaDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].DatumKnjizenja;
						break;
					case "uxOpisDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Opis;
						break;
					case "uxNapomenaDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Napomena;
						break;
					case "uxTvBrojDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].TvBroj;
						break;
					case "uxDetaljiDataGridViewColumn":
						e.Value = OsnovnoSredstvoList[e.RowIndex].Detalji;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxOsnovnoSredstvoDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnOsnovnoSredstvoDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxOsnovnoSredstvoDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxIDParentOSDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].IDParentOS = (System.Int32?)e.Value;
						break;
					case "uxIDDobavljacDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].IDDobavljac = (System.Int32?)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxSifraDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Sifra = (System.String)e.Value;
						break;
					case "uxKolicinaDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Kolicina = (System.Decimal)e.Value;
						break;
					case "uxDatumKnjizenjaDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].DatumKnjizenja = (System.DateTime?)e.Value;
						break;
					case "uxOpisDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Opis = (System.String)e.Value;
						break;
					case "uxNapomenaDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Napomena = (System.String)e.Value;
						break;
					case "uxTvBrojDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].TvBroj = (System.String)e.Value;
						break;
					case "uxDetaljiDataGridViewColumn":
						OsnovnoSredstvoList[e.RowIndex].Detalji = (System.String)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
